#include "Aspect.hpp"

using namespace Typhoon;

Aspect::Aspect() { }

Aspect::Aspect( const Aspect& other ) {
	components = other.components;
}

Aspect::~Aspect() { }

bool Aspect::DoesSatisfy(const std::vector<IGameComponent*>& components ) const {
	int count = this->components.size();
	int componentsSize = components.size();
	for (int i=0; i<count; i++) {
		unsigned int index = this->components[i];
		if (index>=componentsSize) return false;
		if (!components[index]) return false;
	}
	return true;
}

bool Aspect::operator==( const Aspect& other ) const
{
	if (components.size() != other.components.size()) return false;
	unsigned int min = components.size()<other.components.size() ? components.size() : other.components.size();
	for (unsigned int i=0; i<min; i++) {
		if (components[i]!=other.components[i]) return false;
	}
	return true;
}

bool Aspect::operator!=( const Aspect& other ) const
{
	return !((*this) == other);
}
